package ru.geyes.screw.thread.atom;

/**
 * @author alex
 *         date 28.05.2008
 *         time 14:38:33
 */
public interface AtomAction {

    /**
     * init atom action
     */
    public void init();

    /**
     * Do some action.
     * @return true for continue, false for stop iteration
     */
    public boolean action();

    /**
     * call for thread iterrupt
     * @return true for exit, false for working
     */
    public boolean isStopForIterrupt();

    /**
     * call after stop action
     * @param isIterrupted true is action is iterrupted, false for normal exit 
     */
    public void destroy(boolean isIterrupted);

    /**
     * Run for exception in action run.
     * @param e throwable exception
     */
    public void exitWithException(Throwable e);
}
